#include "zf_common_headfile.h"
enum obstacle_type_e obstacle_type = OBSTACLE_NONE;
void check_obstacle(void)
{

    if (    obstacle_type == OBSTACLE_NONE
            && is_straight0
            &&ipts1_num_x0>18
            &&ipts1_num_x1>6
//            &&road_width[clip(0.4 / sample_dist,0,road_width_num-1)]<0.85*pixel_per_meter * ROAD_WIDTH
    )
    {
        obstacle_type = OBSTACLE_RIGHT_BEGIN;
        General_distance_flag = 1;
        Beep(1);
    }else if(obstacle_type == OBSTACLE_NONE
            && is_straight1
            &&ipts0_num_x1>18
            &&ipts0_num_x0>6
            )
    {
        obstacle_type = OBSTACLE_LEFT_BEGIN;
        Beep(1);
        General_distance_flag = 1;
    }
}
void run_obstacle(void)
{
    if(obstacle_type == OBSTACLE_RIGHT_BEGIN)
    {
        track_type = TRACK_LEFT;
        if(General_distance>=85)
        {
            General_distance_flag = 0;
            Beep(0);
            obstacle_type = OBSTACLE_NONE;
        }
    }else if(obstacle_type == OBSTACLE_LEFT_BEGIN)
    {
        track_type = TRACK_RIGHT;
        if(General_distance>=85)
        {
            General_distance_flag = 0;
            Beep(0);
            obstacle_type = OBSTACLE_NONE;
        }
    }
}
